//
//  UIBarButtonItem+Extention.m
//  HMWeiBoOC
//
//  Created by GD on 16/9/19.
//  Copyright © 2016年 geduo. All rights reserved.
//

#import "UIBarButtonItem+Extention.h"

@implementation UIBarButtonItem (Extention)

-(instancetype)initwithTitle:(NSString *)title imageName:(NSString *)imageName target:(id)target action:(SEL)selector{

    UIButton *btn = [[UIButton alloc] init];
    
    if (imageName) {
        [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    }
    
    [btn addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
    
    [btn setTitle:title forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor orangeColor] forState:UIControlStateHighlighted];
    
    btn.titleLabel.font = [UIFont systemFontOfSize:14];
    [btn sizeToFit];
    return [[UIBarButtonItem alloc] initWithCustomView:btn];
    
}

@end


